<!DOCTYPE html>
<html lang="zh-CN">

	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1 , user-scalable=no" />
		<title>Document</title>
		<link rel="stylesheet" href="../../css/bootstrap.min.css" />
		<script src="../../js/jquery.min.js"></script>
		<script src="../js/echarts.min.js"></script>
		<script src="../../js/my_connect.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<div id="myEcharts" class="container" style="height:400px; margin-top: 60px;"></div>


		<script>
			// 基于准备好的dom，初始化echarts实例
			let myChart = echarts.init(document.getElementById('myEcharts'));



			//将统计数据获取到
			fetch("../../api/Account.php/ArticleCount")
			.then(res=>res.json())
			.then(res => {
				console.log(res);
				let option = {
					// title: {
					// 	text: '最近5个工作日文章统计'
					// },
					legend: {
						// top: '5%',
						// left: 'center',
						data:["文章数量"]
					},
					xAxis: {
						name: "发布时间",
						type: 'category',
						data: res.data.time
					},
					yAxis: {
						type: 'value',
						name: '发布数量'
					},
					series: [{
						name:'文章数量',
						data: res.data.count,
						type: 'bar',
						showBackground: true
					}]
				};
				myChart.setOption(option);
			})
		</script>
	</body>

</html>
